<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商户信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 80px;">商户编号：</label>
                                <input type="text" name="merno"/>
                            </li>
                            <li>
                                <label style="width: 80px;">商户名称：</label>
                                <input type="text" name="merName"/>
                            </li>
                            <li>
                                <label style="width: 80px;">服务商编号：</label>
                                <input type="text" name="agentNo"/>
                            </li>
                            <li>
                                <label style="width: 80px;">服务商名称：</label>
                                <input type="text" name="agentInfo.agentName"/>
                            </li>
                            <li>
                                <label style="width: 80px;">手机号：</label>
                                <input type="text" name="linkPhone" placeholder="精确搜索"/>
                            </li>
                            <li>
                                <label style="width: 80px;">商户状态：</label>
                                <select name="merStatus" th:with="type=${@dict.getType('mer_status')}">
                                    <option value="">请选择</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 80px;">商户类型：</label>
                                <select name="merType" th:with="type=${@dict.getType('mer_type')}">>
                                    <option value="">请选择</option>
                                    <option  th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <label style="width: 80px;">结算人名：</label>
                                <input type="text" name="accounts.screenName"/>
                            </li>

                            <li>
                                <label style="width: 80px;">身份证号：</label>
                                <input type="text" name="legalCerno" placeholder="精确搜索"/>
                            </li>
                            <li>
                                <label style="width: 80px;">渠道商户号：</label>
                                <input type="text" name="ldMerno"/>
                            </li>
                            <li>
                                <label style="width: 80px;">结算周期：</label>
                                <select name="settleCycle">
                                    <option value="">所有</option>
                                    <option value="0">D0</option>
                                    <option value="1">T1</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">添加日期：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginAddDate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endAddDate]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('merchantInfo:merchantInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('merchantInfo:merchantInfo:remove')}]];
        var lookInfoFlag= [[${@permission.hasPermi('merchantInfo:merchantInfo:lookInfo')}]];
        var prefix = ctx + "merchantInfo/merchantInfo";
        var merType = [[${@dict.getType('mer_type')}]];
        var merStatus = [[${@dict.getType('mer_status')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "商户信息",
                clickToSelect:true,
                columns: [{
                    radio: true
                },
                {
                    field: 'merno',
                    title: '商户编号',
                },
                {
                    field: 'ldMerno',
                    title: '渠道商户号'
                },
                {
                    field: 'merName',
                    title: '商户名称',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,3);
                    }
                },
                {
                    field: 'merLevel',
                    title: '商户等级',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,3);
                    }
                },
                {
                    field: 'merNature',
                    title: '商户性质',
                    align: 'center',
                    formatter: function(value, row, index) {
                        if ("0"==value){
                            return "企业";
                        }else if("1"==value){
                            return "个人";
                        }else if("3"==value){
                            return "Mpos个人";
                        }else if("4"==value){
                            return "Mpos企业";
                        }else if("5"==value){
                            return "大Pos个人";
                        }else if("6"==value){
                            return "大Pos企业";
                        }else{
                            return "无";
                        }
                    }
                },
                {
                    field: 'merDqType',
                    title: '电签标识',
                    formatter:function (value, row, index) {
                        if ("A"==value){
                            return "电签9号";
                        }else if("B"==value){
                            return "电签5号";
                        }else{
                            return "无";
                        }
                    }
                },
                {
                    field: 'accounts.screenName',
                    title: '结算人'
                },
                {
                    field: 'merArea',
                    title: '商户地区',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,3);
                    }
                },
                {
                    field: 'merAddress',
                    title: '详细地址',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,3);
                    }
                },
                {
                    field: 'showLegalcerno',
                    title: '展示身份证号'
                },
                {
                    field: 'showLinkphone',
                    title: '展示手机号'
                },
                {
                    field: 'merType',
                    title: '商户类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(merType, value);
                    }
                },
                {
                    field: 'merStatus',
                    title: '商户状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(merStatus, value);
                    }
                },

                {
                    field: 'agentNo',
                    title: '服务商编号'
                },
                {
                    field: 'agentInfo.agentName',
                    title: '服务商名称'
                },
                {
                    field: 'settleCycle',
                    title: '结算周期',
                    formatter:function (value, row, index) {
                        if ("0"==value){
                            return "D0";
                        }else if("1"==value){
                            return "T1";
                        }else{
                            return "无";
                        }
                    }
                },
                {
                    field: 'note',
                    title: '备注',
                    width: 60,
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'addDate',
                    title: '添加日期',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,4);
                    }
                },
                {
                    field: 'addTime',
                    title: '添加时间'
                },
                {
                    field: 'legalCerno',
                    title: '身份证号',
                    visible: false

                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + lookInfoFlag + '" href="javascript:void(0)" onclick="lookInfo(\''+row.merno+'\')"><i class="fa fa-plus"></i>查看详情</a> ');
                        return actions.join('');
                    }
                },]
            };
            $.table.init(options);
        });

        function submitHandler(index, layero) {
            var rows = $.table.selectFirstColumns();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录");
                return;
            }
            $.modal.close();
            // 父页面的变量
            parent.$('#merNo').val($.table.selectColumns("merno"));
            parent.$('#merName').val($.table.selectColumns("merName"));
            parent.$('#legalCerno').val($.table.selectColumns("legalCerno"));
            parent.$('#agentNum').val($.table.selectColumns("agentNo"));
        }

    </script>
</body>
</html>
